<?php
	require_once(dirname(__FILE__)."/../config/config.main.php");
	require_once(dirname(__FILE__).'/../config/config.language.php');
	class Template {
		var $Buffer = ''; // HTML Buffer
		var $SourceDirectory = TEMPLATES_FILESYSTEM;
		
		function Template($title, $source=null) {
			if($source != null) $this->SourceDirectory = $source;
			$this->Buffer = $this->_loadToBuffer($title);
		}
		
		function _loadToBuffer($filename) {
			if(file_exists($this->SourceDirectory.$filename)) {
				return file_get_contents($this->SourceDirectory.$filename);	
			} else {
				return sprintf(PASTE_ERROR_SYSTEM_TEMPLATE_NOT_FOUND, $this->SourceDirectory.$filename);
			}
		}
	}
?>